package IO;

import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

public class ISRDemo {
    public static void main(String[] args) throws Exception{
        InputStreamReader isr = new InputStreamReader(new FileInputStream("osw.txt"), StandardCharsets.UTF_8);
        /*
        * int read()
        * 读取一个字符（到底读取几个字节要根据它的内容以及对应的字符集来决定
        * 返回的int值实际上是一个char，返回-1不是读取了末尾
        * */
        int d;
        while ((d=isr.read())!=-1){
            System.out.print((char) d);
        }
        isr.close();
    }
}
